Pandas Series
Index Labels: Race Names
Question: How many people of each race are represented in this dataset?
import pandas as pd
number_of_race = pd.Series(
)
So the question comes with,
How are we going to get the values of the race names?
Okay so
data.value_counts()
Oh wait, is this an SQL database? or csv?
It's a csv file
So the question
How can we get the values of the column race
And then transform it into pandas series
Specifically, how to get values of a column in a csv file
# Read the CSV file into a DataFrame
df = pd.read_csv('your_file.csv')
# Access the values of a specific column
column_values = df['column_name']
Hmm, okay, so we must always convert any file to a "Dataframe"
for us to make pandas work on it
Oh, just by extracting 1 column already makes it a pandas series
So we can just say that dataframe are just a collection of more than one pandas series
Oh wait, we forgot that the index labels must be the race names